<@master template="/common/master"  title="首页-p2p金融">
    <@include file="/common/head"/>
  	<@head title="设置交易密码" dColor="dlHeader"/>
    <form id="submitForm" role="form" action="/member/rest/resetTranPwd/ajaxSubmit" class="form-horizontal" method="POST">
    <div class="dlBox">
    	<p id="errorText" class="wrong">${errorMsg}</p>
        <ul class="dllist">
        	<li>
        		<a id="obtainMobileValidateCode" href="javascript:void(0);"  class="yzm fr">获取验证码</a><span class="sjIco icon"></span>
        		<a id="reSendMobileValidateCode" href="javascript:void(0);" class="yzm fr" style="display: none;"><span id="spanMsg">60秒后可重发</span></a>
        		<input type="text" name="erifyCode" value="" placeholder="请输入手机验证码">
        		</li>
            <li><span class="dlIco icon"></span><input name="pw" type="password" placeholder="输入你的交易陆密码"></li>
            <li><span class="dlIco icon"></span><input name="repeatPW" type="password" placeholder="请在输入你的交易密码"></li>
        </ul>
    </div>
    <div class="btnBox">
    	<input id="submitBtn" type="button" value="确认修改"  class="tzBtn"/>
        <p class="c999 tac mt10">为保障您的资金安全，认证后只能绑定与实名为同一个人的银行卡</p>
    </div>
    </form>
</@master>
<@js>
	var smsInterval = 60;
    $(document).ready(function(){
    	$('#submitBtn').bind("click",function(){
    		var erifyCode=$('#submitForm input[name="erifyCode"]').val();
    		if(!erifyCode){
    			$('#errorText').text('验证码不能为空');
    			return false;
    		}
    		var pw=$('#submitForm input[name="pw"]').val();
    		if(!pw){
    			$('#errorText').text('请输入新密码');
    			return false;
    		}
    		var repeatPW=$('#submitForm input[name="repeatPW"]').val();
    		if(!repeatPW){
    			$('#errorText').text('请再次输入新密码');
    			return false;
    		}
    		if(pw != repeatPW ){
    			$('#errorText').text('新密码输入不一致');
    			return false;
    		}
			$.ajax({
				url: $("#submitForm").attr("action"),
				type: "POST",
				data: $("#submitForm").serialize(),
				success:function(result){
					if(result.data == true){
						window.location.href='/member/ftl/set';
					}else{
						$('#errorText').text(result.data);
					}
				}
			});
    	});
    	$("#obtainMobileValidateCode").bind("click",function(){
			var _this = $(this);
			_this.disabled = 'disabled';
			setTimeout(function() {
				_this.disabled = 'disabled';
			}, 5000)
    		$.ajax({
	 			url:"/member/rest/resetTranPwd/sendAuthCode",
	 			dataType:"json",
	 			data:{},
	 			success:function(msgResult){
	 				if(msgResult.data = true){
	  					$("#reSendMobileValidateCode").show();
						$("#obtainMobileValidateCode").hide();
						window.regSmsIntervalTimer = window.setInterval("smscountdown()", 1000);
	 				}
	 			}
	 		});
    	})
	});
    function smscountdown() {
		if (smsInterval <= 0) {
			window.clearInterval(regSmsIntervalTimer);
			smsInterval = 60;
			$("#reSendMobileValidateCode").hide();
			$("#obtainMobileValidateCode").show();
		}else{
			smsInterval = smsInterval - 1;
			$("#spanMsg").html(smsInterval+"秒后可重发");
		}
	};
</@js>
<@jsRender/>